package cn.jinjimi.app.main.uicontroller;

import android.view.View;
import android.widget.TextView;

import cn.jinjimi.app.R;

/**
 * Created by Roy
 * Date: 15/11/27
 */
public class NavTitleBarController {
    private View mBarView;
    private TextView tvTitle;

    public NavTitleBarController(View view) {
        if (null != view) {
            mBarView = view;
            tvTitle = (TextView) view.findViewById(R.id.tv_title);
        }
    }

    public void setTitle(CharSequence title) {
        if (null != tvTitle) {
            tvTitle.setText(title);
        }
    }

    public void setTitle(int resId) {
        tvTitle.setText(resId);
    }

    public void setTitltClickAction(View.OnClickListener listener) {
        if (null != tvTitle) {
            tvTitle.setOnClickListener(listener);
        }
    }

    public View getBar() {
        return mBarView;
    }

    public void showBar() {
        if (mBarView != null)
            mBarView.setVisibility(View.VISIBLE);
    }

    public void hideBar() {
        if (mBarView != null)
            mBarView.setVisibility(View.GONE);
    }

    public void onDestory() {

    }

}
